<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-paperdef-edit" >
		<input id="id" name="id"th:value="${paperdef.id}"  type="hidden">
			<div class="form-group">
			<label class="col-sm-3 control-label">试卷名称：</label>
			<div class="col-sm-8">
				<input id="name" name="name" th:value="${paperdef.name}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">问卷目的：</label>
			<div class="col-sm-8">
				<textarea id="intro" name="intro" class="form-control" rows="3">[[${paperdef.intro}]]</textarea>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">科目：</label>
			<div class="col-sm-8">
				<select id="kmid"  name="kmid" th:value="${paperdef.kmid}" class="form-control noselect2 selectpicker">
                	<option value=""> -- 请选择科目 -- </option>
                	<option th:each="km : ${kms}" th:value="${km.id}" th:selected="${paperdef.kmid==km.id}" th:text="${km.name}"></option>
                </select>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">试卷状态off关闭,默认on开放：</label>
			<div class="col-sm-8">
				<div class="onoffswitch">
					<input type="checkbox" th:checked="${paperdef.status==1?true:false}" class="onoffswitch-checkbox" id="status" name="status">
					<label class="onoffswitch-label" for="status">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">开始时间：</label>
			<div class="col-sm-8 input-group date">
				<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				<input id="starttime" name="starttime" th:value="${#dates.format(paperdef.starttime,'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text">
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">结束时间：</label>
			<div class="col-sm-8 input-group date">
				<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				<input id="endtime" name="endtime" th:value="${#dates.format(paperdef.endtime,'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">考试时长(分钟)：</label>
			<div class="col-sm-8">
				<input id="duration" name="duration"th:value="${paperdef.duration}" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">禁止交卷时长(分钟)：</label>
			<div class="col-sm-8">
				<input id="nojj" name="nojj"th:value="${paperdef.nojj}" class="form-control" type="text">
			</div>
		</div>
		</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
	var prefix = ctx + "qn/paperdef";
	$("#form-paperdef-edit").validate({
		onkeyup: false,
		rules:{
			name:{
				required:true
			},
			intro:{
				required:true
			},
			kmid:{
				required:true
			},
			starttime:{
				required:true
			},
			endtime:{
				required:true
			},
			duration:{
				required:true,
				digits:true
			}
		}
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/editDo", $('#form-paperdef-edit').serialize());
		}
	}
</script>
</body>
</html>
